package com.kunya.common.common;

import com.google.common.collect.Sets;
import java.util.Set;

public class Const {

	public static final String CURRENT_USER = "currentUser";
	public static final String PHONE="phone";
	public static final String EMAIL = "email";
	public static final String USERNAME = "username";
	public static final String TOKEN_PREFIX="token_";
	public static final String TABLE_PREFIX="currentCmsPrefix";
	public static final String TIME="Time";


	public interface RedisCacheExtime{
		//redis  Session超时有效期30分钟test
		int REDIS_SESSION_EXTIME=60*30;
		//短信验证码有效期（过期不做删除，执行完业务逻辑后手动删除）
		int REDIS_MESSAGE_CODE_EXTIME=60*5;
		//短信重发，时间限制
		int REDIS_MESSAGE_CODE_LIMIT=60;
	}
	public enum SendMessageEnum{
		FIRSTSEND(1, "未发送过短信验证码"),
		RESEND(2, "可再次发送短信验证码"),
		DISABLERESEND(2, "可再次发送短信验证码");
		SendMessageEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}
		private String value;
		private int code;
		public String getValue() {
			return value;
		}
		public int getCode() {
			return code;
		}

	}

	public enum PaymentTypeEnum {
		ONLINE_PAY(1, "在线支付");

		PaymentTypeEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private String value;
		private int code;

		public String getValue() {
			return value;
		}

		public int getCode() {
			return code;
		}

		public static PaymentTypeEnum codeOf(int code) {
			for (PaymentTypeEnum paymentTypeEnum : values()) {
				if (paymentTypeEnum.getCode() == code) {
					return paymentTypeEnum;
				}
			}
			throw new RuntimeException("mei有找到对应的枚举");
		}
	}

	public enum PayPlatformEnum {
		ALIPAY(1, "支付宝");

		PayPlatformEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private String value;
		private int code;

		public String getValue() {
			return value;
		}

		public int getCode() {
			return code;
		}
	}

	public interface AlipayCallback {
		String TRADE_STATUS_WAIT_BUYER_PAY = "WAIT_BUYER_PAY";
		String TRADE_STATUS_TRADE_SUCCESS = "TRADE_SUCCESS";

		String RESPONSE_SUCCESS = "success";
		String RESPONSE_FAILED = "failed";
	}

	public enum OrderStatusEnum {
		NO_PAY(10, "提交订单"), PAID(20, "支付完成"), WAITS_DELIVERY(30, "等待收货"), SHIPPED(40, "确认收货"), COMMENT_FINISH(50,
				"评价完成"), ORDER_CLOSE_SELF(60, "自动取消订单");

		OrderStatusEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		private String value;
		private int code;

		public String getValue() {
			return value;
		}

		public int getCode() {
			return code;
		}

		public static OrderStatusEnum codeOf(int code) {
			for (OrderStatusEnum orderStatusEnum : values()) {
				if (orderStatusEnum.getCode() == code) {
					return orderStatusEnum;
				}
			}
			throw new RuntimeException("么有找到对应的枚举");
		}
	}

	public interface Cart {
		Byte CHECKED = 1;// 购物车选中状态
		Byte UN_CHECKED = 0;// 购物车未选中状态
		String LIMIT_NUM_FAIL = "LIMIT_NUM_FAIL";
		String LIMIT_NUM_SUCCESS = "LIMIT_NUM_SUCCESS";
	}

	public interface Role {
		int ROLE_CUSTOMER = 0;// 普通用户
		int ROLE_ADMIN = 1;// 管理员
	}

	public interface ProductListOrderBy {
		Set<String> PRICE_ASC_DESC = Sets.newHashSet("price_desc", "price_asc");
	}

	public enum ProductStatusEnum {
		ON_SALE(1, "在线");
		private String value;
		private int code;

		ProductStatusEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}

		public String getValue() {
			return value;
		}

		public int getCode() {
			return code;
		}
	}

	/**
	 * @author zp
	 * @Description: 商品规格表状态枚举
	 * @param
	 * @date 2018/7/4 13:32
	 */
	public enum kindStatusEnum {
		DISPLAY(1, "显示"),
		HIDE(0,"隐藏");
		private String value;
		private int code;
		kindStatusEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}
		public String getValue() {
			return value;
		}

		public int getCode() {
			return code;
		}
	}

	/**
	 * @author zp
	 * @Description: 商品规格属性表(product_specification)状态枚举类
	 * @param
	 * @date 2018/7/4 14:03
	 */
	public enum productSpecStatusEnum {
		DELETE(3,"删除"),
		OFFSHELVES(2, "下架"),
		ONSHELVES(1, "上架"),
		NEW(0,"新增");
		private String value;
		private int code;
		productSpecStatusEnum(int code, String value) {
			this.code = code;
			this.value = value;
		}
		public String getValue() {
			return value;
		}

		public int getCode() {
			return code;
		}
	}

}
